package br.urca.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Embeddable;

@Embeddable
public class EquivalenciaPK implements Serializable {
	
	private static final long serialVersionUID = 1L;

	@Column(name = "cddis", columnDefinition = "CHAR(10)")
	private String codDisciplina;
	
	@Column(name = "cddiseq", columnDefinition = "CHAR(10)")
	private String codDisciplinaEquiv;
	
	@Deprecated public EquivalenciaPK() { }

	public EquivalenciaPK(String codDisciplina, String codDisciplinaEquiv) {
		super();
		this.codDisciplina = codDisciplina;
		this.codDisciplinaEquiv = codDisciplinaEquiv;
	}

	public String getCodDisciplina() {
		return codDisciplina;
	}

	public void setCodDisciplina(String codDisciplina) {
		this.codDisciplina = codDisciplina;
	}

	public String getCodDisciplinaEquiv() {
		return codDisciplinaEquiv;
	}

	public void setCodDisciplinaEquiv(String codDisciplinaEquiv) {
		this.codDisciplinaEquiv = codDisciplinaEquiv;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((codDisciplina == null) ? 0 : codDisciplina.hashCode());
		result = prime
				* result
				+ ((codDisciplinaEquiv == null) ? 0 : codDisciplinaEquiv
						.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		EquivalenciaPK other = (EquivalenciaPK) obj;
		if (codDisciplina == null) {
			if (other.codDisciplina != null)
				return false;
		} else if (!codDisciplina.equals(other.codDisciplina))
			return false;
		if (codDisciplinaEquiv == null) {
			if (other.codDisciplinaEquiv != null)
				return false;
		} else if (!codDisciplinaEquiv.equals(other.codDisciplinaEquiv))
			return false;
		return true;
	}
	
}
